/*
 * Filename CheckDataConverter.java 2021年09月27日
 * Copyright © Ehome Co.Ltd. All Rgiths Reserved.
 * @author wuyingchao
 */
package com.ehome.poct.core.dao.dataconverter;

import cn.hutool.json.JSONObject;
import com.ehome.poct.core.api.dto.check.CellAlgoRequestLog;
import com.ehome.poct.core.api.dto.check.CellCheckDataDTO;
import com.ehome.poct.core.dao.entity.check.CellAlgoReqLogDO;
import com.ehome.poct.core.dao.entity.check.CheckDataDO;

/**
 * 检测数据 转换器
 *
 * @author wyc
 * @since 2021/09/27 11:08
 **/
public class CellCheckDataConverter {
    public static CellAlgoReqLogDO toAlgoRepLog(CellAlgoRequestLog algoLog) {
        return new CellAlgoReqLogDO().setAlgoReqLogId(algoLog.getId()).setReqUrl(algoLog.getReqUrl())
                .setReqJson(new JSONObject(algoLog.getRequest()).toString())
                .setSno(algoLog.getSno()).setRspJson(algoLog.getResponseContent()).setOssFilePath(algoLog.getFilePath());
    }
    
    public static CheckDataDO toCheckDataDO(CellCheckDataDTO data) {
        return new CheckDataDO().setAlgoReqId(data.getReqId()).setTermClinicId(data.getClinicId()).setPatientId(data.getPatientId())
                .setOssFileId(data.getFilePath()).setCheckType(data.getCheckType()).setSno(data.getDeviceSno())
                .setBoardId(data.getBoardSno()).setCheckStatus(data.getStatus());
    }





}